﻿@*
    Copyright 2014 Francois Karman

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*@
@model Quartz.WebManager.Model.JobDetail
<h1>
    @(Model.Group).@(Model.Name)
    <small>Update</small>
</h1>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(m => m.Name)
                @Html.TextBoxFor(m => m.Name, new { @class = "form-control", @readonly = "readonly" })
                <span class="help-block">The name of this task - this field is part of the job identifier and can't be modified.</span>
                @Html.ValidationMessageFor(m => m.Name)
            </div>
            <div class="form-group">
                @Html.LabelFor(m => m.Group)
                @Html.TextBoxFor(m => m.Group, new { @class = "form-control", @readonly = "readonly" })
                <span class="help-block">The group of the task - this field is part of the job identifier and can't be modified.</span>
                @Html.ValidationMessageFor(m => m.Group)
            </div>
            <div class="form-group">
                @Html.LabelFor(m => m.Description)
                @Html.TextAreaFor(m => m.Description, 8, 0, new { @class = "form-control" })
                @Html.ValidationMessageFor(m => m.Description)
            </div>
        </div>
        <div class="form-group col-md-6">
            @foreach (var property in @Model.Properties)
            {
                var definition = Model.Definition.Properties.First(d => d.Name == property.Key);
                <div class="form-group">
                    <label for="Properties[@property.Key]">@definition.DisplayName</label>
                    @Html.TextBoxFor(m => m.Properties[property.Key], new { @class = "form-control" })
                    <span class="help-block">@definition.Description</span>
                    @Html.ValidationMessageFor(m => m.Properties[property.Key])
                </div>
            }
        </div>
    </div>
    @Html.HiddenFor(m => m.JobType)
    <button type="submit" class="btn btn-primary">Update</button>
    <a href="@Url.Action("ViewJobDetail", "Home", new { group = Model.Group, name = Model.Name })" class="btn btn-link">Cancel</a>
}